#include <iostream>
struct thing1
{
    int a;
    char ch;
    double x;
};
struct thing2
{
    int a;
    double x;
    char ch;
};

int main(int argc, char const *argv[])
{
    std::cout << "alignof(int): " << alignof(int) << std::endl;
    std::cout << "alignof(char): " << alignof(char) << std::endl;
    std::cout << "alignof(double): " << alignof(double) << std::endl;
    
    std::cout << "alignof(thing1): " << alignof(thing1) << std::endl;
    std::cout << "alignof(thing2): " << alignof(thing2) << std::endl;
    std::cout << "sizeof(thing1): " << sizeof(thing1) << std::endl;
    std::cout << "sizeof(thing2): " << sizeof(thing2) << std::endl; 
    /*
    输出:
    alignof(int): 4
    alignof(char): 1
    alignof(double): 8
    alignof(thing1): 8
    alignof(thing2): 8
    sizeof(thing1): 16
    sizeof(thing2): 24
    */
    // sizeof(thing1):是8说明他们的字节数要是8的整数倍，因为thing1的前两个可以合并到一个8字节中，所以比thing2少了8个字节
    float aF = 1 / 10.0F;
    if(aF == 0.1){
        std::cout << "equal" << std::endl;
    }else{
        std::cout << "not equal" << std::endl;
    }

    return 0;
}


